package com.delivery.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebConfig implements WebMvcConfigurer  {
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")  // 匹配所有的路径
                    .allowCredentials(true) // 设置允许凭证
                    .allowedHeaders("*")   // 设置请求头
                    .allowedMethods("*") // 设置允许的方式
                    .allowedOriginPatterns("*");
        }


}